Skip to content

Add check to ensure initialOwner is not a ProxyAdmin contract when deploying a transparent proxy#1083

Merged
ericglau merged 15 commits intoOpenZeppelin:masterfrom
ericglau:transparentowner
Sep 23, 2024
Merged

Add check to ensure initialOwner is not a ProxyAdmin contract when deploying a transparent proxy#1083
ericglau merged 15 commits intoOpenZeppelin:masterfrom
ericglau:transparentowner

Conversation

@ericglau
Copy link
Copy Markdown
Member

@ericglau ericglau commented Sep 20, 2024

With OpenZeppelin Contracts v5, the initialOwner when deploying a transparent proxy must not be a predeployed ProxyAdmin contract. The transparent proxy deploys its own ProxyAdmin using this initialOwner as the owner, therefore the initialOwner must be an EOA or a contract that is able to call functions on a ProxyAdmin.

This PR adds the following check: if the initialOwner when deploying a transparent proxy is a contract that has an owner() getter which returns something that looks like an address, it might be a ProxyAdmin contract. In this case, throw an error.

It may have false positives if the initialOwner is some other contract (such as a smart account) which has an owner. If this false positive occurs and the user is sure that the initialOwner is a contract that can invoke functions on a ProxyAdmin but is not a ProxyAdmin itself, this check can be skipped with the unsafeSkipProxyAdminCheck option.

Hardhat equivalent of OpenZeppelin/openzeppelin-foundry-upgrades#76

@socket-security
Copy link
Copy Markdown

socket-security bot commented Sep 20, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/sinon@19.0.2 None +2 5.84 MB cjohansen, fatso83, mantoni, ...1 more

🚮 Removed packages: npm/@openzeppelin/upgrades-core@1.37.1

View full report↗︎

@ericglau ericglau requested a review from a team September 20, 2024 19:45
@github-actions github-actions bot mentioned this pull request Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants